﻿@using ZBJF.Warranty.Common.Common
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" />
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title</title>
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/layer")
    @Scripts.Render("~/bundles/wdate")
    @Scripts.Render("~/bundles/common")
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/font-awesome")
    @RenderSection("Header", false)
    <script type="text/javascript">
    $(function () {
        var timestamp = "@long.MaxValue";
        var responseResult = "@(JSON.Encode(TempData["ResponseResult"]))";
        if ("@(TempData["timestamp"] != null && !string.IsNullOrEmpty(TempData["timestamp"].ToString()))" == "True") {
            timestamp = "@TempData["timestamp"]";
        }
        var timeDiff = (new Date().getTime()) - parseInt(timestamp);
        //小于2.3秒代表是非后退操作 取决于razor视图的渲染速度
        if (timeDiff < 2300 && responseResult != "") {
            var index = layer.load();
            responseResult = JSON.parse(HtmlUtil.htmlDecode(responseResult));
            var msg = responseResult.Message;
            if (!responseResult.Success || msg.indexOf("失败") > 0 || msg.indexOf("错误") > 0 || msg.indexOf("存在") > 0) {
                layer.alert(HtmlUtil.htmlDecode(msg), { icon: 2 });
            } else {
                layer.msg(HtmlUtil.htmlDecode(msg), { icon: 6, time: 3000 });
            }
            layer.close(index);
        }
    });
    </script>
</head>
<body class="padding-5">
    @RenderBody()
    @RenderSection("scripts", required: false)
    @{
        string hasNoRightOperationActionList = ViewBag.HasNoRightOperationActionList ?? "";
    }
    <script type="text/javascript">
        function ControlPermissionOperate() {
            var operationActionList = "@hasNoRightOperationActionList".split(",");
            if ($.trim(operationActionList) !== "") {
                for (var i = 0; i < operationActionList.length; i++) {

                    $("." + operationActionList[i]).remove();
                }
            }
        }
        $(function () {
            ControlPermissionOperate();
        });
    </script>
</body>
</html>
